package com.etc.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etc.entity.Students;
import com.etc.service.StudentService;
import com.etc.util.MyDBUtil;
import com.etc.util.PageData;
import com.google.gson.Gson;

@Controller
public class StudentController {
	@Resource(name = "stuservice")
	private StudentService ss;

	public StudentService getSs() {
		return ss;
	}

	public void setSs(StudentService ss) {
		this.ss = ss;
	}

	/**
	 * 页面的调用方法
	 */
	@RequestMapping(value = "index")
	public String getIndex(HttpServletRequest request, HttpServletResponse response) throws IOException {
		return "studentlist";
	};

	@RequestMapping(value = "studentlimit")
	@ResponseBody
	public PageData<Students> getStudentLimit(int page, int limit, String content) {

		// int page = 1;
		// int limit = 2;
		// String content = "";
		if (content == null) {
			content = "";
		}
		PageData<Students> studentLimit = ss.getStudentLimit(page, limit, content);
		studentLimit.setCode(0);
		return studentLimit;

	}

}
